form_control的问题

一、文件位置

\wp-content\themes\mingyue_store\woocommerce\single-product-reviews.php

代码:

  1. <?php
  2. /**
  3. * Display single product reviews (comments)
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/single-product-reviews.php.
  6. *
  7. * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
  8. * will need to copy the new files to your theme to maintain compatibility. We try to do this.
  9. * as little as possible, but it does happen. When this occurs the version of the template file will.
  10. * be bumped and the readme will list any important changes.
  11. *
  12. * @see http://docs.woothemes.com/document/template-structure/
  13. * @author WooThemes
  14. * @package WooCommerce/Templates
  15. * @version 2.3.2
  16. */
  17. global $product;
  18. if ( ! defined( 'ABSPATH' ) ) {
  19. exit; // Exit if accessed directly
  20. }
  21. if ( ! comments_open() ) {
  22. return;
  23. }
  24. ?>
  25. <div id="reviews">
  26. <div id="comments">
  27. <h2><?php
  28. if ( get_option( 'woocommerce_enable_review_rating' ) === 'yes' && ( $count = $product->get_review_count() ) )
  29. printf( _n( '%s review for %s', '%s reviews for %s', $count, 'woocommerce' ), $count, get_the_title() );
  30. else
  31. _e( 'Reviews', 'woocommerce' );
  32. ?></h2>
  33. <?php if ( have_comments() ) : ?>
  34. <ol class="commentlist">
  35. <?php wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ) ); ?>
  36. </ol>
  37. <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
  38. echo '<nav class="woocommerce-pagination">';
  39. paginate_comments_links( apply_filters( 'woocommerce_comment_pagination_args', array(
  40. 'prev_text' => '&larr;',
  41. 'next_text' => '&rarr;',
  42. 'type' => 'list',
  43. ) ) );
  44. echo '</nav>';
  45. endif; ?>
  46. <?php else : ?>
  47. <p class="woocommerce-noreviews"><?php _e( 'There are no reviews yet.', 'woocommerce' ); ?></p>
  48. <?php endif; ?>
  49. </div>
  50. <?php if ( get_option( 'woocommerce_review_rating_verification_required' ) === 'no' || wc_customer_bought_product( '', get_current_user_id(), $product->id ) ) : ?>
  51. <div id="review_form_wrapper">
  52. <div id="review_form form-horizontal">
  53. <?php
  54. $commenter = wp_get_current_commenter();
  55. $comment_form = array(
  56. 'title_reply' => have_comments() ? __( 'Add a review', 'woocommerce' ) : sprintf( __( 'Be the first to review &ldquo;%s&rdquo;', 'woocommerce' ), get_the_title() ),
  57. 'title_reply_to' => __( 'Leave a Reply to %s', 'woocommerce' ),
  58. 'comment_notes_before' => '',
  59. 'comment_notes_after' => '',
  60. 'fields' => array(
  61. 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'woocommerce' ) . ' <span class="required">*</span></label> ' .
  62. '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" /></p>',
  63. 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'woocommerce' ) . ' <span class="required">*</span></label> ' .
  64. '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" aria-required="true" /></p>',
  65. ),
  66. 'label_submit' => __( 'Submit', 'woocommerce' ),
  67. 'logged_in_as' => '',
  68. 'comment_field' => ''
  69. );
  70. if ( $account_page_url = wc_get_page_permalink( 'myaccount' ) ) {
  71. $comment_form['must_log_in'] = '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a review.', 'woocommerce' ), esc_url( $account_page_url ) ) . '</p>';
  72. }
  73. if ( get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) {
  74. $comment_form['comment_field'] = '<p class="comment-form-rating"><label for="rating">' . __( 'Your Rating', 'woocommerce' ) .'</label> <select name="rating" id="rating">
  75. <option value="">' . __( 'Rate&hellip;', 'woocommerce' ) . '</option>
  76. <option value="5">' . __( 'Perfect', 'woocommerce' ) . '</option>
  77. <option value="4">' . __( 'Good', 'woocommerce' ) . '</option>
  78. <option value="3">' . __( 'Average', 'woocommerce' ) . '</option>
  79. <option value="2">' . __( 'Not that bad', 'woocommerce' ) . '</option>
  80. <option value="1">' . __( 'Very Poor', 'woocommerce' ) . '</option>
  81. </select></p>';
  82. }
  83. $comment_form['comment_field'] .= '<div class="form-group comment-form-comment"><label class="col-sm-2 control-label" for="comment">' . __( 'Your Review', 'woocommerce' ) . '</label> <textarea id="comment" class="form-control" name="comment" rows="8" aria-required="true"></textarea></div>';
  84. $comment_form['comment_field'] .= '<div class="form-group"><label for="comment" class=" text-center col-sm-2 control-label">'. __( 'Your Review', 'woocommerce' ) .'</label><div class="col-sm-10"><textarea id="comment" class="form-control" rows="8" name="comment"></textarea></div></div>';
  85. comment_form( apply_filters( 'woocommerce_product_review_comment_form_args', $comment_form ) );
  86. ?>
  87. </div>
  88. </div>
  89. <?php else : ?>
  90. <p class="woocommerce-verification-required"><?php _e( 'Only logged in customers who have purchased this product may leave a review.', 'woocommerce' ); ?></p>
  91. <?php endif; ?>
  92. <div class="clear"></div>
  93. </div>